package 牛客网编程.剑指offer.旋转数组最小数字;

/**
 * create at 2018/10/20
 * author: suveng
 * email: suveng@163.com
 **/
import java.util.ArrayList;
public class Solution {
    public int minNumberInRotateArray(int [] array) {
        if(array.length==0){
            return 0;
        }
        int[] des=new int[array.length];
        int pos = 0;
        for(int i =0 ; i<array.length-1;i++)
        {
            if(array[i]>array[i+1]){
                pos=i;
                break;
            }
        }
        System.arraycopy(array,pos+1,des,0,array.length-1-pos);
        System.arraycopy(array,0,des,array.length-1-pos,pos+1);
        return des[0];
    }
}
